package org.demo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 首页
 *
 * @author dingshenzhen
 */
@RequestMapping("/")
@RestController
public class IndexController {
    @Value("${spring.application.name}")
    private String applicationName;

    @RequestMapping("")
    public Mono<String> index() {
        String message = "你好，当前时间是：" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        message = message + "\r\n" + applicationName;
        return Mono.just(message);
    }
}
